#ifndef XL_UPLOADER_TRANSPARENT_STATIC_H
#define XL_UPLOADER_TRANSPARENT_STATIC_H
#include <atlstr.h>
#include <atltypes.h>
#include <atlbase.h>
#include <atlapp.h>
#include <atlwin.h>
#include <atlctrls.h>
#include "../libuploader/libxluploader.h"

typedef CWinTraits<
	WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CHILD,
	0
	> CTransparentStaticTraits;

class CTransparentStatic
	: public CWindowImpl<CTransparentStatic, ATL::CWindow, CTransparentStaticTraits>
{
public:
	enum Align {
		LEFT,
		CENTER,
		RIGHT
	};
	static const int ICON_SIZE = 16;
	static const int ICON_PADDING = 2;

protected:
	ATL::CWindow      *m_sibling;
	tstring            m_title;
	COLORREF           m_rgbText;
	HFONT              m_font;
	Align              m_align;
	HICON              m_icon;

	virtual void drawContent(HDC hdc);

	// virtual HFONT getFont();
	virtual void onSetFont() {}
	virtual void onSetText() {}
	virtual void onSetIcon() {}
	virtual void onSetAlign() {}

	UINT _GetDrawTextFormat();

public:
	DECLARE_WND_CLASS(_T("xl::TransparentStatic"))
	CTransparentStatic(void);
	virtual ~CTransparentStatic(void);

	void setSibling(ATL::CWindow *);
	COLORREF setTextColor(COLORREF rgbText);
	void setAlign(CTransparentStatic::Align);
	void setIcon(HICON icon);


	BEGIN_MSG_MAP(CTransparentStatic)
		MESSAGE_HANDLER(WM_SETTEXT, OnSetText)
		MESSAGE_HANDLER(WM_PAINT, OnPaint)
		MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkGnd)
		MESSAGE_HANDLER(WM_SETFONT, OnSetFont)
		MESSAGE_HANDLER(WM_GETFONT, OnGetFont)
		MESSAGE_HANDLER(WM_CREATE, OnCreate)
		MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
	END_MSG_MAP()

	LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnSetText(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnEraseBkGnd(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnSetFont(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnGetFont(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
};

#endif
